var ftpManager = require('./ftpManager');
const fs = require('fs');
async function main() {
    let a = new ftpManager({
        host: '127.0.0.1',
        user: 'lmon',
        password: 'lmontree'
    });
    let b =await a.connectFtp();    ////确实可以等待  事件返回的数据
    b.get('test.txt', function (err, stream) {
        if (err) throw err;
        stream.once('close', function () { b.end(); });  //触发事件 结束流数据
        stream.pipe(fs.createWriteStream('test.local-copy.txt'));
    })
}

main();
